﻿<ResourceDictionary   
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
  xmlns:pg="http://schemas.denisvuyka.wordpress.com/wpfpropertygrid"
  xmlns:theme="clr-namespace:System.Windows.Controls.WpfPropertyGrid.Themes.Kaxaml"  
  >
  
  <BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter"/>
    
  <!-- Button -->

  <Style TargetType="{x:Type Button}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Foreground" Value="#DDD"/>
    <Setter Property="FontSize" Value="7.5pt"/>
    <Setter Property="MinHeight" Value="20"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="HorizontalContentAlignment" Value="Center"/>

    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Grid>
            <Border x:Name="Background" CornerRadius="3" BorderBrush="#888888" BorderThickness="0,1,0,0">
              <Border.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                  <GradientStop Offset="0.0" Color="#585858" />
                  <GradientStop Offset="1.2" Color="#282828" />
                </LinearGradientBrush>
              </Border.Background>
            </Border>
            <Border x:Name="BackgroundHighlighted" Opacity="0" BorderThickness="0,1,0,1" CornerRadius="3" BorderBrush="#282828">
              <Border.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                  <GradientStop Offset="0.0" Color="#505050" />
                  <GradientStop Offset="1.2" Color="#383838" />
                </LinearGradientBrush>
              </Border.Background>
            </Border>
            <Border x:Name="BackgroundSunken" BorderBrush="#000000" BorderThickness="0,0,0,1" CornerRadius="3" />
            <ContentPresenter x:Name="Content" Margin="0,0,0,2" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#888888" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#686868" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#282828" Duration="0:0:0.1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.2" />
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.2" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsFocused" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#989898" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#787878" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#383838" Duration="0:0:0.1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.2" />
                    <ColorAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.2" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter TargetName="Content" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
              <Setter TargetName="BackgroundSunken" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
              <Setter TargetName="Background" Property="Opacity" Value="0" />
              <Setter TargetName="BackgroundHighlighted" Property="Opacity" Value="1" />
              <Setter TargetName="BackgroundSunken" Property="BorderBrush" Value="#555" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Foreground" Value="#777"/>
              <Setter Property="Opacity" Value="0.75"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- Checkbox -->

  <Style TargetType="{x:Type CheckBox}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Foreground" Value="#DDD"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type CheckBox}">
          <BulletDecorator Background="Transparent">
            <BulletDecorator.Bullet>
              <Grid Width="11" Height="11" Margin="0,1,0,0">
                <Border x:Name="Background" Background="#444444" CornerRadius="0" />
                <Border x:Name="BackgroundHighlighted" BorderBrush="#808080" BorderThickness="0,0,0,1" CornerRadius="0" />
                <Border x:Name="BackgroundSunken" BorderBrush="#101010" BorderThickness="0,1,0,0" CornerRadius="0" />
                <Path x:Name="Arrow" 
                      Margin="0,-2,0,0" 
                      Opacity="0" 
                      Fill="{x:Null}" 
                      Stretch="Fill" 
                      Stroke="{TemplateBinding Foreground}" 
                      StrokeEndLineCap="Round" 
                      StrokeLineJoin="Round" 
                      StrokeStartLineCap="Round" 
                      StrokeThickness="2" 
                      Width="9" 
                      Height="10" 
                      Data="M203.44033,309.51348 L206.49521,313.93147 212.24245,303.99957" />
              </Grid>
            </BulletDecorator.Bullet>
            <ContentPresenter Margin="8,0,0,0" />
          </BulletDecorator>
          <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
              <Setter TargetName="Arrow" Property="Opacity" Value="1" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter TargetName="Arrow" Property="Opacity" Value="0.5" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- TextBox -->

  <Style TargetType="{x:Type TextBox}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="Foreground" Value="#DDD"/>
    <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="MinWidth" Value="100"/>
    <Setter Property="MinHeight" Value="18"/>
    <Setter Property="AllowDrop" Value="true"/>
    <Setter Property="pg:TextBoxExtender.SelectAllOnFocus" Value="True"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TextBoxBase}">
          <Grid>
            <Border x:Name="Background" Background="#444444" CornerRadius="2" />
            <Border x:Name="BackgroundHighlighted" BorderBrush="#808080" BorderThickness="0,0,0,1" CornerRadius="2" />
            <Border x:Name="BackgroundSunken" BorderBrush="#101010" BorderThickness="0,1,0,0" CornerRadius="2" />
            <ScrollViewer Margin="0,2,0,0" x:Name="PART_ContentHost" />
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Foreground" Value="#777"/>
              <Setter Property="Opacity" Value="0.75"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
		
	<!-- PasswordBox -->

  <Style TargetType="{x:Type PasswordBox}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="Foreground" Value="#DDD"/>
    <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="MinWidth" Value="100"/>
    <Setter Property="MinHeight" Value="18"/>
    <Setter Property="AllowDrop" Value="true"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type PasswordBox}">
          <Grid>
            <Border x:Name="Bg" Background="#444444" CornerRadius="2" />
            <Border x:Name="Hl" BorderBrush="#808080" BorderThickness="0,0,0,1" CornerRadius="2" />
            <Border x:Name="Sh" BorderBrush="#101010" BorderThickness="0,1,0,0" CornerRadius="2" />
            <ScrollViewer Margin="0,2,0,0" x:Name="PART_ContentHost" />
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Foreground" Value="#777"/>
              <Setter Property="Opacity" Value="0.75"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- ScrollViewer -->

  <Style TargetType="{x:Type ScrollViewer}">
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollViewer}">
          <Grid x:Name="Grid" Background="Transparent">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Margin="0,0,0,0" CanHorizontallyScroll="False" CanVerticallyScroll="False"/>
            <ScrollBar x:Name="PART_VerticalScrollBar"
                       Grid.Column="1"
                       Grid.Row="0"
                       Margin="0,4,4,4"
                       AutomationProperties.AutomationId="VerticalScrollBar"
                       Maximum="{TemplateBinding ScrollableHeight}"
                       Minimum="0"
                       Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
                       ViewportSize="{TemplateBinding ViewportHeight}"
                       Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger SourceName="PART_VerticalScrollBar" Property="Visibility" Value="Visible">
              <Setter TargetName="PART_ScrollContentPresenter" Property="Margin" Value="0,0,4,0" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- Scrollbar-->

  <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="IsTabStop" Value="false"/>
    <Setter Property="Focusable" Value="false"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Background="Transparent"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="HorizontalScrollBarThumb" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="IsTabStop" Value="false"/>
    <Setter Property="Focusable" Value="false"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Grid Background="Transparent">
            <Border Height="8" Background="#FFF" BorderThickness="0.5,1" CornerRadius="3"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="VerticalScrollBarThumb" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="IsTabStop" Value="false"/>
    <Setter Property="Focusable" Value="false"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Grid Background="Transparent">
            <Border Width="8" Background="#FFF" BorderThickness="1,0.5" CornerRadius="3"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <ControlTemplate x:Key="VerticalScrollBarTemplate" TargetType="{x:Type ScrollBar}">
    <Grid Width="8">
      <Border Width="8" Background="#18000000" CornerRadius="3"/>
      <Track Name="PART_Track" IsDirectionReversed="true">
        <Track.DecreaseRepeatButton>
          <RepeatButton Command="ScrollBar.PageUpCommand" Style="{DynamicResource ScrollBarPageButton}"/>
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb x:Name="Thumb" Opacity="0.25" Style="{DynamicResource VerticalScrollBarThumb}"/>
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton Command="ScrollBar.PageDownCommand" Style="{DynamicResource ScrollBarPageButton}"/>
        </Track.IncreaseRepeatButton>
      </Track>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Trigger.EnterActions>
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation Duration="0:0:0.25" Storyboard.TargetName="Thumb" Storyboard.TargetProperty="Opacity" To="1"/>
            </Storyboard>
          </BeginStoryboard>
        </Trigger.EnterActions>
        <Trigger.ExitActions>
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation Duration="0:0:0.25" Storyboard.TargetName="Thumb" Storyboard.TargetProperty="Opacity"/>
            </Storyboard>
          </BeginStoryboard>
        </Trigger.ExitActions>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <ControlTemplate x:Key="HorizontalScrollBarTemplate" TargetType="{x:Type ScrollBar}">
    <Grid Height="8">
      <Border Height="8" Background="#18000000" CornerRadius="3"/>
      <Track Name="PART_Track" IsDirectionReversed="false">
        <Track.DecreaseRepeatButton>
          <RepeatButton Command="ScrollBar.PageUpCommand" Style="{DynamicResource ScrollBarPageButton}"/>
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb x:Name="Thumb" Opacity="0.25" Style="{DynamicResource HorizontalScrollBarThumb}"/>
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton Command="ScrollBar.PageDownCommand" Style="{DynamicResource ScrollBarPageButton}"/>
        </Track.IncreaseRepeatButton>
      </Track>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Trigger.EnterActions>
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation Duration="0:0:0.25" Storyboard.TargetName="Thumb" Storyboard.TargetProperty="Opacity" To="1"/>
            </Storyboard>
          </BeginStoryboard>
        </Trigger.EnterActions>
        <Trigger.ExitActions>
          <BeginStoryboard>
            <Storyboard>
              <DoubleAnimation Duration="0:0:0.25" Storyboard.TargetName="Thumb" Storyboard.TargetProperty="Opacity"/>
            </Storyboard>
          </BeginStoryboard>
        </Trigger.ExitActions>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <Style TargetType="{x:Type ScrollBar}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="Template" Value="{DynamicResource VerticalScrollBarTemplate}"/>
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="Template" Value="{DynamicResource HorizontalScrollBarTemplate}"/>
      </Trigger>
    </Style.Triggers>
  </Style>

  <!-- Slider -->

  <Style x:Key="SliderButtonStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="IsTabStop" Value="false"/>
    <Setter Property="Focusable" Value="false"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Background="Transparent"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="SliderThumbStyle" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="false"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Grid>
            <Path Width="9" Height="16" Margin="2,2,0,0" Fill="#8000" Stretch="Fill" Stroke="#8000" Data="M160,400 L160,310 200,280 240,310 240,400 z"/>
            <Path Width="9" Height="16" Stretch="Fill" Data="M160,400 L160,310 200,280 240,310 240,400 z">
              <Path.Fill>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                  <GradientStop Offset="0.05" Color="#666"/>
                  <GradientStop Offset="0.25" Color="#404040"/>
                  <GradientStop Offset="0.95" Color="#FF222222"/>
                </LinearGradientBrush>
              </Path.Fill>
              <Path.Stroke>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                  <GradientStop Offset="0.0" Color="#FFC5C5C5"/>
                  <GradientStop Offset="0.4" Color="#FF5F5F5F"/>
                  <GradientStop Offset="0.8" Color="#FF494949"/>
                </LinearGradientBrush>
              </Path.Stroke>
            </Path>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <ControlTemplate x:Key="HorizontalSliderTemplate" TargetType="{x:Type Slider}">
    <Grid>
      <TickBar x:Name="TopTick" Height="1" Fill="#7FFF" Placement="Top" SnapsToDevicePixels="True" Visibility="Collapsed"/>
      <Path Height="12" Canvas.Top="11.98" Margin="4,0" Stretch="Fill" Stroke="#2FFF" StrokeThickness="1" Data="M80,320 L560,320 560,290 80,315 z">
        <Path.Fill>
          <LinearGradientBrush StartPoint="0.198,0.457" EndPoint="0.215,2.283">
            <GradientStop Offset="0" Color="#3000"/>
            <GradientStop Offset="0.3" Color="#407F7F7F"/>
          </LinearGradientBrush>
        </Path.Fill>
      </Path>
      <Track x:Name="PART_Track" Height="35">
        <Track.DecreaseRepeatButton>
          <RepeatButton Command="Slider.DecreaseLarge" Style="{DynamicResource SliderButtonStyle}"/>
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb Style="{DynamicResource SliderThumbStyle}"/>
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton Command="Slider.IncreaseLarge" Style="{DynamicResource SliderButtonStyle}"/>
        </Track.IncreaseRepeatButton>
      </Track>
      <TickBar x:Name="BottomTick" Height="1" Canvas.Top="35" Fill="{TemplateBinding Foreground}" Placement="Bottom" SnapsToDevicePixels="True" Visibility="Collapsed"/>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="TickPlacement" Value="TopLeft">
        <Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
      </Trigger>
      <Trigger Property="TickPlacement" Value="BottomRight">
        <Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
      </Trigger>
      <Trigger Property="TickPlacement" Value="Both">
        <Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
        <Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <Style TargetType="{x:Type Slider}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="Template" Value="{DynamicResource HorizontalSliderTemplate}"/>
      </Trigger>
    </Style.Triggers>
  </Style>

  <!-- ComboBox -->

  <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition Width="20" />
      </Grid.ColumnDefinitions>
      <Grid Grid.ColumnSpan="2">
        <Border x:Name="Bg" CornerRadius="3" BorderBrush="#888888" BorderThickness="0,1,0,0">
          <Border.Background>
            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
              <GradientStop Offset="0.0" Color="#585858" />
              <GradientStop Offset="1.2" Color="#282828" />
            </LinearGradientBrush>
          </Border.Background>
        </Border>
        <Border x:Name="Dn" Opacity="0" BorderThickness="0,1,0,1" CornerRadius="3" BorderBrush="#282828">
          <Border.Background>
            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
              <GradientStop Offset="0.0" Color="#585858" />
              <GradientStop Offset="1.2" Color="#383838" />
            </LinearGradientBrush>
          </Border.Background>
        </Border>
        <Border x:Name="Sh" BorderBrush="#000000" BorderThickness="0,0,0,1" CornerRadius="3" />
        <ContentPresenter x:Name="Content" Margin="0,0,0,2" HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True"/>
      </Grid>
      <Path x:Name="Arrow" Grid.Column="1" Fill="{TemplateBinding Foreground}" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z"/>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="true">
        <Trigger.EnterActions>
          <BeginStoryboard>
            <Storyboard>
              <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#888888" Duration="0:0:0.1" />
              <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#686868" Duration="0:0:0.1" />
              <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#282828" Duration="0:0:0.1" />
            </Storyboard>
          </BeginStoryboard>
        </Trigger.EnterActions>
        <Trigger.ExitActions>
          <BeginStoryboard>
            <Storyboard>
              <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Duration="0:0:0.1" />
              <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.2" />
              <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.2" />
            </Storyboard>
          </BeginStoryboard>
        </Trigger.ExitActions>
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Foreground" Value="#777"/>
        <Setter Property="Opacity" Value="0.75"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <ControlTemplate x:Key="ComboBoxTextBox" TargetType="{x:Type TextBox}">
    <Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" />
  </ControlTemplate>

  <Style TargetType="{x:Type ComboBox}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
    <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
    <Setter Property="Foreground" Value="#DDD"/>
    <Setter Property="MinHeight" Value="20"/>
    <Setter Property="MinWidth" Value="70"/>
    <!--<Setter Property="ItemContainerStyle" Value="{DynamicResource ComboBoxItem}"/>-->
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <VirtualizingStackPanel/>
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ComboBox}">
          <Grid>
            <ToggleButton
              MinWidth="0" 
              Name="ToggleButton"
              Template="{DynamicResource ComboBoxToggleButton}"
              Foreground="{TemplateBinding Foreground}"
              Grid.Column="2"
              Focusable="false"
              IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
              ClickMode="Press">
            </ToggleButton>
            <ContentPresenter
              Name="ContentSite"
              IsHitTestVisible="False"
              Content="{TemplateBinding SelectionBoxItem}"
              ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
              ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
              Margin="6,0,23,2"
              VerticalAlignment="Center"
              HorizontalAlignment="Left" />
            <TextBox
              x:Name="PART_EditableTextBox"
              HorizontalAlignment="Left"
              Margin="3,0,23,3"
              VerticalAlignment="Center"
              Background="Transparent"
              Focusable="True"
              Foreground="{TemplateBinding Foreground}"
              IsReadOnly="{TemplateBinding IsReadOnly}"
              Style="{x:Null}"
              Template="{DynamicResource ComboBoxTextBox}"/>
            <Popup
              Name="Popup"
              Placement="Bottom"
              VerticalOffset="0"
              IsOpen="{TemplateBinding IsDropDownOpen}"
              AllowsTransparency="True"
              Focusable="False"
              PopupAnimation="Fade">

              <aero:SystemDropShadowChrome Margin="0,0,5,5" CornerRadius="4">
                <Grid Name="DropDown" SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
                  <Border x:Name="DropDownBorder" Background="#585858" CornerRadius="4" />
                  <ScrollViewer SnapsToDevicePixels="True">
                    <theme:IndexingStackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                  </ScrollViewer>
                </Grid>
              </aero:SystemDropShadowChrome>
            </Popup>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasItems" Value="false">
              <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
            </Trigger>
            <Trigger Property="IsGrouping" Value="true">
              <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="{x:Type ComboBoxItem}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ComboBoxItem}">
          <Border Name="Border" SnapsToDevicePixels="true">
            <ContentPresenter Margin="4,2,4,3" />
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsHighlighted" Value="true">
              <Setter TargetName="Border" Property="Background" Value="#707070" />
            </Trigger>
            <Trigger Property="theme:IndexingStackPanel.StackLocation" Value="First">
              <Setter TargetName="Border" Property="CornerRadius" Value="4,4,0,0" />
            </Trigger>
            <Trigger Property="theme:IndexingStackPanel.StackLocation" Value="Last">
              <Setter TargetName="Border" Property="CornerRadius" Value="0,0,4,4" />
            </Trigger>
            <Trigger Property="theme:IndexingStackPanel.StackLocation" Value="FirstAndLast">
              <Setter TargetName="Border" Property="CornerRadius" Value="4" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- Expander -->

  <Style TargetType="{x:Type Expander}">
    <Setter Property="Padding" Value="8"/>
    <Setter Property="Foreground" Value="#FFFFFFFF"/>
    <Setter Property="Background" Value="#00FFFFFF"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Expander}">
          <Grid>
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Border Grid.Row="0" x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
              <ToggleButton IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" HorizontalContentAlignment="Stretch">
                <ToggleButton.Content>
                  <StackPanel Orientation="Horizontal">
                    <Path Grid.Column="0"
                          SnapsToDevicePixels="True"
                          IsHitTestVisible="False"
                          Name="Arrow"
                          Margin="8,0,8,0"
                          Fill="#0FFF"
                          RenderTransformOrigin="0.5,0.5"
                          HorizontalAlignment="Right"
                          VerticalAlignment="Center"
                          Data="M 0 0 L 0 8 L 5 4 Z"
                          Stroke="{TemplateBinding Foreground}"
                          StrokeThickness="0.5">
                      <Path.RenderTransform>
                        <RotateTransform Angle="0" />
                      </Path.RenderTransform>
                    </Path>
                    <ContentPresenter Margin="4" Grid.Column="1" RecognizesAccessKey="True" ContentSource="Header"/>
                  </StackPanel>
                </ToggleButton.Content>
              </ToggleButton>
            </Border>

            <!--<theme:Reveal x:Name="ContentReveal" Grid.Row="1" VerticalReveal="FromTopToBottom" HorizontalReveal="None">-->
            <!-- the extra border here is required because Reveal doesn't account for margins -->
            <Border Grid.Row="1" Visibility="{Binding Path=IsExpanded, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource booleanToVisibilityConverter}}">
              <Border BorderThickness="0.5,1,0,0" BorderBrush="#6000" Background="#10FFFFFF" CornerRadius="2,3,2,2" SnapsToDevicePixels="True" Margin="2" >
                <Border BorderThickness="0,0,0.5,1" BorderBrush="#20FFFFFF" CornerRadius="2,3,2,2">
                  <ContentPresenter x:Name="PART_ContentPresenter" Content="{TemplateBinding Content}" ToolTipService.IsEnabled="False" />
                </Border>
              </Border>
            </Border>
            <!--</theme:Reveal>-->
          </Grid>
          <ControlTemplate.Triggers>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition SourceName="Border" Property="IsMouseOver" Value="True" />
                <Condition Property="IsExpanded" Value="False" />
              </MultiTrigger.Conditions>
              <Setter TargetName="Border" Property="Background" Value="#20FFFFFF" />
              <Setter TargetName="Border" Property="Cursor" Value="Hand" />
            </MultiTrigger>
            <Trigger Property="IsExpanded" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <!--<DoubleAnimation BeginTime="0:0:0.2" Storyboard.TargetName="ContentReveal" Storyboard.TargetProperty="AnimationProgress" Duration="0:0:0.2" To="1" DecelerationRatio="1" />-->
                    <DoubleAnimation Storyboard.TargetName="Arrow" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(RotateTransform.Angle)" Duration="0:0:0.2" To="90" DecelerationRatio="1" />
                    <ColorAnimation Storyboard.TargetName="Arrow" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)" Duration="0:0:0.2" To="#FFF" DecelerationRatio="1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <!--<DoubleAnimation Storyboard.TargetName="ContentReveal" Storyboard.TargetProperty="AnimationProgress" Duration="0:0:0.2" AccelerationRatio="1" />-->
                    <DoubleAnimation  Storyboard.TargetName="Arrow" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(RotateTransform.Angle)" Duration="0:0:0.2" AccelerationRatio="1" />
                    <ColorAnimation Storyboard.TargetName="Arrow" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)" Duration="0:0:0.2" AccelerationRatio="1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- ToggleButton -->

  <Style  TargetType="{x:Type ToggleButton}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Foreground" Value="#DDD"/>
    <Setter Property="FontSize" Value="7.5pt"/>
    <Setter Property="MinHeight" Value="20"/>
    <Setter Property="MinWidth" Value="20"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="HorizontalContentAlignment" Value="Center"/>

    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ToggleButton}">
          <Grid>
            <Border x:Name="Bg" CornerRadius="3" BorderBrush="#888888" BorderThickness="0,1,0,0">
              <Border.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                  <GradientStop Offset="0.0" Color="#585858" />
                  <GradientStop Offset="1.2" Color="#FF6A6969" />
                </LinearGradientBrush>
              </Border.Background>
            </Border>
            <Border x:Name="Dn" Opacity="0" BorderThickness="0,1,0,1" CornerRadius="3" BorderBrush="#282828" >
              <Border.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                  <GradientStop Offset="0.0" Color="#505050" />
                  <GradientStop Offset="1.2" Color="#383838" />
                </LinearGradientBrush>
              </Border.Background>
            </Border>
            <Border x:Name="Sh" BorderBrush="#000000" BorderThickness="0,0,0,1" CornerRadius="3" />
            <ContentPresenter x:Name="Content" Margin="0,0,0,2" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#888888" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#686868" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#282828" Duration="0:0:0.1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.2" />
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.2" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter TargetName="Content" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
              <Setter TargetName="Sh" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
              <Setter TargetName="Bg" Property="Opacity" Value="0" />
              <Setter TargetName="Dn" Property="Opacity" Value="1" />
              <Setter TargetName="Sh" Property="BorderBrush" Value="#555" />
            </Trigger>

            <Trigger Property="IsChecked" Value="true">
              <Setter TargetName="Content" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
              <Setter TargetName="Sh" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
              <Setter TargetName="Bg" Property="Opacity" Value="0" />
              <Setter TargetName="Dn" Property="Opacity" Value="1" />
              <Setter TargetName="Dn" Property="Background">
                <Setter.Value>
                  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0.0" Color="#404040" />
                    <GradientStop Offset="1.2" Color="#FF000000" />
                  </LinearGradientBrush>
                </Setter.Value>
              </Setter>
              <Setter TargetName="Sh" Property="BorderBrush" Value="#666" />
            </Trigger>

            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Foreground" Value="#777"/>
              <Setter Property="Opacity" Value="0.5"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!--<Style TargetType="{x:Type ToggleButton}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Foreground" Value="#DDD"/>
    <Setter Property="FontSize" Value="7.5pt"/>
    <Setter Property="MinHeight" Value="20"/>
    <Setter Property="MinWidth" Value="70"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="HorizontalContentAlignment" Value="Center"/>

    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ToggleButton}">
          <Grid>
            <Border x:Name="Bg" CornerRadius="3" BorderBrush="#888888" BorderThickness="0,1,0,0">
              <Border.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                  <GradientStop Offset="0.0" Color="#585858" />
                  <GradientStop Offset="1.2" Color="#282828" />
                </LinearGradientBrush>
              </Border.Background>
            </Border>
            <Border x:Name="Dn" Opacity="0" BorderThickness="0,1,0,1" CornerRadius="3" BorderBrush="#282828" >
              <Border.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                  <GradientStop Offset="0.0" Color="#505050" />
                  <GradientStop Offset="1.2" Color="#383838" />
                </LinearGradientBrush>
              </Border.Background>
            </Border>
            <Border x:Name="Sh" BorderBrush="#000000" BorderThickness="0,0,0,1" CornerRadius="3" />
            <ContentPresenter x:Name="Content" Margin="0,0,0,2" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard>
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#888888" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#686868" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#282828" Duration="0:0:0.1" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard>
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Duration="0:0:0.1" />
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.2" />
                    <ColorAnimation Storyboard.TargetName="Bg" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.2" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter TargetName="Content" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
              <Setter TargetName="Sh" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
              <Setter TargetName="Bg" Property="Opacity" Value="0" />
              <Setter TargetName="Dn" Property="Opacity" Value="1" />
              <Setter TargetName="Sh" Property="BorderBrush" Value="#555" />
            </Trigger>

            <Trigger Property="IsChecked" Value="true">
              <Setter TargetName="Content" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
              <Setter TargetName="Sh" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
              <Setter TargetName="Bg" Property="Opacity" Value="0" />
              <Setter TargetName="Dn" Property="Opacity" Value="1" />
              <Setter TargetName="Dn" Property="Background">
                <Setter.Value>
                  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0.0" Color="#404040" />
                    <GradientStop Offset="1.2" Color="#181818" />
                  </LinearGradientBrush>
                </Setter.Value>
              </Setter>
              <Setter TargetName="Sh" Property="BorderBrush" Value="#666" />
            </Trigger>

            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Foreground" Value="#777"/>
              <Setter Property="Opacity" Value="0.5"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>-->
  
  <!-- PropertyGrid -->
  
  <Style TargetType="{x:Type pg:PropertyGrid}" BasedOn="{StaticResource {x:Type pg:PropertyGrid}}">    
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1.0">
          <GradientStop Color="#FF232323" Offset="0"/>
          <GradientStop Color="#FF000000" Offset="1"/>
          <GradientStop Color="#FF393939" Offset="0.48"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemsBackground" Value="#FF333333"/>
    <Setter Property="ItemsForeground" Value="White"/>
  </Style>
  
  <!-- TabbedLayout -->

  <Style TargetType="{x:Type pg:TabbedLayout}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="IsSynchronizedWithCurrentItem" Value="True"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type pg:TabbedLayout}">
          <Grid Background="{Binding Background}">
            <Grid Margin="2">
              <Grid.RowDefinitions>
                <RowDefinition Height="25" />
                <RowDefinition x:Name="RowDefinition1" Height="*" />
              </Grid.RowDefinitions>
              <Border CornerRadius="4,4,0,0" BorderBrush="#777" BorderThickness="0,1,0,0">
                <Border.Background>
                  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0.0" Color="#505050" />
                    <GradientStop Offset="1.0" Color="#282828" />
                  </LinearGradientBrush>
                </Border.Background>
                <StackPanel Orientation="Horizontal">
                  <theme:IndexingStackPanel Orientation="Horizontal" IsItemsHost="True" />
                  <Rectangle x:Name="Highlight" Width="1" Fill="#2FFF" HorizontalAlignment="Left" />
                </StackPanel>
              </Border>

              <Border Grid.Row="1" Background="{Binding Background}">
                <Border BorderThickness="0.5,1,0,0" BorderBrush="#6000" Background="#10FFFFFF" CornerRadius="2,3,2,2" SnapsToDevicePixels="True" Margin="2" >
                  <ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" />
                </Border>
              </Border>
            </Grid>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>

    <Setter Property="ItemTemplate">
      <Setter.Value>
        <DataTemplate>
          <Grid Margin="-10" Background="#0f00">
            <TextBlock Margin="4">
              <TextBlock Text="{Binding Header}" />
            </TextBlock>
          </Grid>
        </DataTemplate>
      </Setter.Value>
    </Setter>

  </Style>

  <Style x:Key="CloseButton" TargetType="{x:Type Button}">
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Grid SnapsToDevicePixels="False">
            <Ellipse x:Name="Ellipse" >
              <Ellipse.Fill>
                <RadialGradientBrush GradientOrigin="0.5,0.75">
                  <GradientStop Color="#FF6E6E6E" Offset="0.874"/>
                  <GradientStop Color="#FF2F2F2F" Offset="0.152"/>
                  <GradientStop Color="#FF4E4E4E" Offset="0.628"/>
                </RadialGradientBrush>
              </Ellipse.Fill>
              <Ellipse.Stroke>
                <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                  <GradientStop Offset="0.1" Color="#50FFFFFF" />
                  <GradientStop Offset="0.4" Color="#39FFFFFF" />
                  <GradientStop Offset="0.7" Color="#3D000000" />
                  <GradientStop Offset="0.8" Color="#50000000" />
                </LinearGradientBrush>
              </Ellipse.Stroke>
            </Ellipse>
            <Ellipse  Stroke="#28FFFFFF"  Margin="1" />
            <Path x:Name="Path" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0" Stroke="#CCC" StrokeThickness="1.7" Width="6" Height="6" Data="M 0 0 L 6 6 M 6 0 L 0 6 Z"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="Ellipse" Property="Fill" >
                <Setter.Value>
                  <RadialGradientBrush GradientOrigin="0.5,0.766">
                    <GradientStop Color="#FFDA4E26" Offset="0.874"/>
                    <GradientStop Color="#FF531D0D" Offset="0.013"/>
                    <GradientStop Color="#FFAB2F0C" Offset="0.628"/>
                    <GradientStop Color="#FF6C220C" Offset="0.296"/>
                  </RadialGradientBrush>
                </Setter.Value>
              </Setter>
            </Trigger>

            <Trigger Property="IsPressed" Value="True">
              <Setter TargetName="Ellipse" Property="Stroke" >
                <Setter.Value>
                  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0.821" Color="#9EFFFFFF" />
                    <GradientStop Color="#A81C1C1C" Offset="0.152"/>
                    <GradientStop Color="#A03A3A3A" Offset="0.565"/>
                    <GradientStop Color="#9E919191" Offset="0.713"/>
                    <GradientStop Color="#A6323232" Offset="0.238"/>
                  </LinearGradientBrush>
                </Setter.Value>
              </Setter>
              <Setter TargetName="Ellipse" Property="Fill" >
                <Setter.Value>
                  <RadialGradientBrush GradientOrigin="0.5,0.25">
                    <GradientStop Color="#FFDA4E26" Offset="0.874"/>
                    <GradientStop Color="#FF8D280C" Offset="0.471"/>
                  </RadialGradientBrush>
                </Setter.Value>
              </Setter>
              <Setter TargetName="Path" Property="RenderTransform" >
                <Setter.Value>
                  <TranslateTransform Y="1" />
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Visibility" Value="Collapsed" />
            </Trigger>

          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  
  <Style TargetType="{x:Type pg:TabbedLayoutItem}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="Foreground" Value="#FFF" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type pg:TabbedLayoutItem}">
          <Border x:Name="Border" Background="Transparent" BorderBrush="Transparent" BorderThickness="0,1,0,0" Margin="0,-1,0,0">
            <Grid>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
              </Grid.ColumnDefinitions>
              <Border x:Name="Shimmer" Opacity="0">
                <Border.Background>
                  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0.0" Color="#40909090" />
                    <GradientStop Offset="1.0" Color="#40505050" />
                  </LinearGradientBrush>
                </Border.Background>
              </Border>
              <ContentPresenter x:Name="HeaderArea" Content="{TemplateBinding Header}" Margin="12,0,12,3" VerticalAlignment="Center" />
              <Rectangle Grid.Column="0" x:Name="Highlight" Width="1" Fill="#2FFF" HorizontalAlignment="Left" />
              <Rectangle Grid.Column="1" x:Name="Shadow" Width="1" Fill="#7000" HorizontalAlignment="Right" Margin="0,-1,0,0" />

              <Button Margin="0,0,8,3" 
                      Grid.Column="1" x:Name="CloseButton"
                      Style="{StaticResource CloseButton}" Width="14" Height="14" Cursor="Hand" HorizontalAlignment="Right" VerticalAlignment="Center"
                      Visibility="{TemplateBinding CanClose, Converter={StaticResource booleanToVisibilityConverter}}"
                      Command="pg:PropertyGridCommands.ClosePropertyTab"
                      CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type pg:TabbedLayoutItem}}}"/>

            </Grid>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard>
                  <Storyboard >
                    <DoubleAnimation Duration="0:0:0.07" Storyboard.TargetName="Shimmer" Storyboard.TargetProperty="Opacity" To="1.0" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <BeginStoryboard>
                  <Storyboard >
                    <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="Shimmer" Storyboard.TargetProperty="Opacity" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.ExitActions>
            </Trigger>

            <Trigger Property="IsSelected" Value="False">
              <Setter TargetName="CloseButton" Property="Visibility" Value="Collapsed" />
            </Trigger>

            <Trigger Property="IsSelected" Value="True">
              <Setter TargetName="Shimmer" Property="Opacity" Value="0" />
              <Setter TargetName="Border" Property="Background">
                <Setter.Value>
                  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0.0" Color="#909090" />
                    <GradientStop Offset="1.0" Color="#505050" />
                  </LinearGradientBrush>
                </Setter.Value>
              </Setter>
              <Setter TargetName="Border" Property="BorderBrush" Value="#BBB" />
              <Setter TargetName="Highlight" Property="Fill" Value="#3FFF" />
              <Setter TargetName="Shadow" Property="Fill" Value="#8000" />
            </Trigger>

            <Trigger Property="theme:IndexingStackPanel.Index" Value="0">
              <Setter TargetName="Border" Property="CornerRadius" Value="4,0,0,0" />
              <Setter TargetName="Shimmer" Property="CornerRadius" Value="4,0,0,0" />
            </Trigger>

          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  
  <Style TargetType="{x:Type pg:ExtendedPropertyEditorTab}" BasedOn="{StaticResource {x:Type pg:TabbedLayoutItem}}"/>
	
</ResourceDictionary>